import os
import sys
import random
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings')
django.setup()


def setpasswd():
    try:
        from django.contrib.auth.models import User
        user = User.objects.all()
        if len(user) == 0:
            User.objects.create_superuser(
                username="admin", password="admin123456", email="admin@qq.com")
        else:
            pass

    except Exception as e:
        print(e)


if __name__ == '__main__':
    setpasswd()
    # 第一次运行平台设置默认密码
